package server.connector.http;

/*
用于存放HTTP报文的请求行
 */

/*
2023/1/17 该类内容全部写完,后续直接使用,无需修改
by cyl
 */
final class HttpRequestLine {
    //常量
    private static final int INITIAL_METHOD_SIZE = 8;
    private static final int INITIAL_URI_SIZE = 64;
    private static final int INITIAL_PROTOCOL_SIZE = 8;

    public static final int MAX_METHOD_SIZE = 1024;
    public static final int MAX_URI_SIZE = 32758;
    public static final int MAX_PROTOCOL_SIZE = 1024;
    //实例
    char[] method;
    char[] uri;
    char[] protocol;

    //请求方法的长度
    int methodLength;
    int uriLength;
    int protocolLength;

    //构造器
    public HttpRequestLine() {
        this.method = new char[INITIAL_METHOD_SIZE];
        this.uri = new char[INITIAL_URI_SIZE];
        this.protocol = new char[INITIAL_PROTOCOL_SIZE];
    }

    //重新使用
    public void reuse() {
        methodLength = 0;
        uriLength = 0;
        protocolLength = 0;
    }
}
